package com.spring.annotation;

import com.spring.beans.User;
import com.spring.condition.Lcondition;
import com.spring.condition.Wcondition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;

/**
 *  测试Linux 时候 加参数 -Dos.name=Linux
 */
@Configuration
public class ConditionConfig {

    @Bean
    public User user(){
        User user = new User("za", 23);
        return user;
    }

    @Bean
    @Conditional({Lcondition.class})
    public User user1(){
        User user = new User("linux", 100);
        return user;
    }

    @Bean
    @Conditional({Wcondition.class})
    public User user2(){
        User user = new User("windows", 40);
        return user;
    }

}
